Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] 매거진 수정 api 변경, @Valid 적용, domain/s3로 폴더링 변경 #151

Merged
merged 7 commits into from
Mar 10, 2024

Conversation

GaHee99
Copy link
Contributor

@GaHee99 GaHee99 commented Mar 9, 2024

Related Issue 🚀

Work Description ✏️

  • s3폴더 domain으로 이동했습니다!
  • 기존 @Valid로 잡은 에러 메시지를 명확하게 표기하도록 GlobalHandler에 추가했습니다.
  • 매거진 수정 api를 변경했습니다.

PR Point 📸

  • 매거진 수정 api 잘 봐주세요!

기존

  • 매거진 질문 개수 수정 x

변화

  • 매거진 질문 개수 수정 o

Copy link
Contributor

@kjy-asl kjy-asl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니당 머지 하셔도 좋을 것 같아요

Copy link
Member

@dragontaek-lee dragontaek-lee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다~! 짱

String userName,
@NotBlank
@NotEmpty
@NotBlank(message = "info는 \"\"일 수 없습니다.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 ""은 뭘까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"" 빈 스트링 들어올 경우에 message를 나타냅니다!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"" 인 이유가 궁금했습니다!

@@ -33,7 +33,7 @@ public ResponseEntity<ApiResponse> handleIllegalArgumentException(IllegalArgumen

@ExceptionHandler(MethodArgumentNotValidException.class)
public ResponseEntity<ApiResponse> handleMethodArgumentNotValidException(MethodArgumentNotValidException exception){
ApiResponse response = ApiResponse.fail(EMPTY_METHOD_ARGUMENT.getMessage());
ApiResponse response = ApiResponse.fail(exception.getBindingResult().getAllErrors().get(0).getDefaultMessage());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getAllErrors의 0번째말고 다른 인덱스의 값들은 어떤게 들어있나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아래와 같습니당!
{ "success": false, "message": "[Field error in object 'userOnboardRequestDTO' on field 'userName': rejected value []; codes [Size.userOnboardRequestDTO.userName,Size.userName,Size.java.lang.String,Size]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [userOnboardRequestDTO.userName,userName]; arguments []; default message [userName],15,1]; default message [userName의 길이는 1글자 이상 15글자 이하여야 합니다.]]", "data": "" }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이게 0번째 인덱스의 값인가요?

question.setAnswerImage(null);
question.setImageCaption(null);
} else {
question.setAnswerImage(questionVO.answerImage());
question.setImageCaption(questionVO.imageCaption());
}
question.setMagazine(magazine);
return question;
}).collect(Collectors.toList());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

쓰이지 않는데 collect나 리스트 반환형이 필요한 이유가 있을까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

앗 리스트 반환이 필요합니다!
반환 후에 questionRepository에 save됩니다

Copy link
Member

@dragontaek-lee dragontaek-lee Mar 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

음 해당 toQuestionEntity 메서드를 쓰는 곳 들을 보면 호출만 하고 반환값은 쓰이지 않아서요!
create, edit 메서드 모두 void 형 아닌가요?

for (int i = 0; i < requestQuestionSize; i++) {
updateQuestionDetails(currentQuestions.get(i), request.questions().get(i));
}
magazine.getQuestions().removeAll(currentQuestions.subList(request.questions().size(), currentQuestions.size()));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

개수가 같다면 해당 로직은 실행 안해도 될거 같아요!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵~ 수정하겠습니당

@dragontaek-lee dragontaek-lee merged commit ad57a4b into develop Mar 10, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants